<script>
jQuery(document).ready(function(){
jQuery(".side-notes").hide();
jQuery("#sharing_icons").hide();
jQuery("#side-flags").hide();
jQuery("#side-notes").hide();
jQuery("#main-notes").hide();
jQuery("#side-sharing").hide();
<?php 
if(@$questions_like_status == 'Yes')
{
	echo "$('#like_icon').css('background','url(".SKIN_URL_IMAGE."/side-icon-hover1.png)');";	
	echo "$('#like_icon').css('background-repeat','no-repeat');";	
}	
if(@$questions_note['question_bookmark_status'] == 'Yes')
{
	echo "$('#bookmark_icon').css('background','url(".SKIN_URL_IMAGE."/side-icon-hover5.png)');";	
	echo "$('#bookmark_icon').css('background-repeat','no-repeat');";	
}	
if(@$questions_note['question_note'] != '')
{
	echo "$('#notes').css('background','url(".SKIN_URL_IMAGE."/side-icon-hover7.png)');";	
	echo "$('#notes').css('background-repeat','no-repeat');";	
}	
if(@$questions_rate > 0)
{
	echo "$('#rating').css('background','url(".SKIN_URL_IMAGE."/side-icon-hover4.png)');";	
	echo "$('#rating').css('background-repeat','no-repeat');";	
}
?>
jQuery("#plus_notes").click(function(){
jQuery("#questions").hide();
jQuery("#main-notes").show();
jQuery("#side-notes").hide();
});

jQuery("#plus-main_calendar").click(function(){
jQuery("#questions").hide();
jQuery("#main-calendar").show();
jQuery("#side-calendar").hide();
});
/*
$("#minus1").click(function(){
$("#main-notes").hide();
$("#questions").show();
});
*/
/*
$("#minus").click(function(){
$("#main-notes").hide();
$("#questions").show();
});
*/
jQuery("#plus_member_analytics").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics").show();
jQuery("#side-member_analytics").hide();
});

jQuery("#plus_member_analytics2").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics2").show();
jQuery("#side-member_analytics2").hide();
});

jQuery("#plus_member_analytics3").click(function(){
jQuery("#questions").hide();
jQuery("#side-member_analytics3").hide();
jQuery("#main-member_analytics3").show();
});

jQuery("#plus_member_analytics4").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics4").show();
jQuery("#side-member_analytics4").hide();
});

jQuery("#plus_member_analytics5").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics5").show();
jQuery("#side-member_analytics5").hide();
});

jQuery("#plus_member_analytics6").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics6").show();
jQuery("#side-member_analytics6").hide();
});

jQuery("#plus_member_analytics7").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics7").show();
jQuery("#side-member_analytics7").hide();
});

jQuery("#plus_member_analytics8").click(function(){
jQuery("#questions").hide();
jQuery("#main-member_analytics8").show();
jQuery("#side-member_analytics8").hide();
});

jQuery("#plus_question_analytics").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics").show();
jQuery("#side-question_analytics").hide();
});

jQuery("#plus_question_analytics2").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics2").show();
jQuery("#side-question_analytics2").hide();
});

jQuery("#plus_question_analytics3").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics3").show();
jQuery("#side-question_analytics3").hide();
});

jQuery("#plus_question_analytics4").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics4").show();
jQuery("#side-question_analytics4").hide();
});

jQuery("#plus_question_analytics5").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics5").show();
jQuery("#side-question_analytics5").hide();
});

jQuery("#plus_question_analytics6").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics6").show();
jQuery("#side-question_analytics6").hide();
});

jQuery("#plus_question_analytics7").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics7").show();
jQuery("#side-question_analytics7").hide();
});

jQuery("#plus_question_analytics8").click(function(){
jQuery("#questions").hide();
jQuery("#main-question_analytics8").show();
jQuery("#side-question_analytics8").hide();
});

jQuery(".minus").click(function(){
jQuery(".main-notes").hide();
jQuery(".side-notes").hide();
jQuery("#questions").show();
//$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
//$('.member-analytics1 li, .member-analytics2 li, .member-analytics3 li').removeAttr('class');
//$('.question-analytics1 li, .question-analytics2 li, .question-analytics3 li').removeAttr('class');
//jQuery("#show_questionanalytics_download_count_graph_weekly_div_zoom,#show_questionanalytics_download_count_graph_weekly_div").html("");
//jQuery("#show_download_count_graph_weekly_div_zoom, #show_download_count_graph_weekly_div").html("");
jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
});

  jQuery("#show").click(function(){
    jQuery("#full_question").slideDown();	
	jQuery("#hide").show();
	jQuery("#show").hide();
  	//jQuery(".show").addClass(show2);
  });
  jQuery("#hide").click(function(){
    jQuery("#full_question").slideUp();	
	jQuery("#hide").hide();
	jQuery("#show").show();
	});
	
	jQuery("#side-calendar-trigger, #side-calendar-trigger2").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#side-calendar").show();
	$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
	$(this).parent().attr('class','active')
	});
	
	jQuery("#side-upload_question_tip-trigger").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#side-upload_question_tip").show();
	$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
	$(this).parent().attr('class','active')		
	});
	
	jQuery("#side-upload_question-trigger, #side-upload_question-trigger2").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#side-upload_question").show();
	$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
	$(this).parent().attr('class','active')		
	});
	
	jQuery("#flag").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#side-flags").show();
	});
	
	jQuery("#rating").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#rating-div").show();
	});
	
	jQuery("#notes, #scribble-pad").click(function(){
	jQuery(".side-notes").hide();
	jQuery("#side-notes").show();
	$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
	$(this).parent().attr('class','active')		
	});
	
	jQuery("#share, #spread_word, #spread_word2").click(function(){
	jQuery(".side-notes").hide();
	if(jQuery("#sharing_icons").is(':visible') == false)
	{
		jQuery("#sharing_icons").slideDown('slow');
		jQuery(".quebar_icons").hide();
	}
	else
	{
		jQuery("#sharing_icons").hide();
		jQuery(".quebar_icons").show();
	}
	});
	
	jQuery("#tab1").click(function(){
//	jQuery("#side-flags").hide();
//	jQuery("#side-notes").hide();
	jQuery(".side-notes").hide();
	jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
	});
	
	jQuery("#tab2").click(function(){
//	jQuery("#side-flags").hide();
//	jQuery("#side-notes").hide();
	jQuery(".side-notes").hide();
	jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
	});
	
	jQuery("#tab3").click(function(){
//	jQuery("#side-flags").hide();
//	jQuery("#side-notes").hide();
	jQuery(".side-notes").hide();
	jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
	});
	
	jQuery("#tab4").click(function(){
	jQuery(".side-notes").hide();
//	jQuery("#side-flags").hide();
//	jQuery("#side-notes").hide();
	jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
	});
	
	jQuery("#tab5").click(function(){
	jQuery(".side-notes").hide();
//	jQuery("#side-flags").hide();
//	jQuery("#side-notes").hide();
	jQuery('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
	});
	
	//	jQuery("#"+div).toggle( "fast");
	
	jQuery(".expand, .expand3").click( function(){
		//jQuery(".answers2").css({'position':'absolute', 'left':'0px', 'top':'0px','width':'95.6%', 'height':'386px', 'background-color':'#ffffff'}, {duration:500});
		jQuery(".answers2").hide();
		jQuery(".answers3").show();
		jQuery(".expand2, .expand4").show();
		jQuery(".expand, .expand3").hide();
		jQuery("#page_navigation").hide();
		jQuery("#answer_header").removeClass('question_answer_header');
		jQuery("#answer_header").addClass('question_answer_header1');
		$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');
		$(this).parent().attr('class','active')		
	});
		
	jQuery(".expand2,.expand4").click( function(){
		//jQuery(".answers2").css({'position':'absolute', 'left':'0px', 'top':'0px','width':'95.6%', 'height':'386px', 'background-color':'#ffffff'}, {duration:500});	
		jQuery(".answers3").hide();
		jQuery(".answers2").show();
		jQuery(".expand, .expand3").show();
		jQuery(".expand2, .expand4").hide();
		jQuery("#page_navigation").show();
		jQuery("#answer_header").removeClass('question_answer_header1');
		jQuery("#answer_header").addClass('question_answer_header');
		$('.flexipad1 li, .flexipad2 li, .flexipad3 li').removeAttr('class');		
	});	

});
</script>
<script type="text/javascript"
	  src="https://www.google.com/jsapi?autoload={
		'modules':[{
		  'name':'visualization',
		  'version':'1',
		  'packages':['corechart']
		}]
	  }">
</script>
					
<script>
function change_likeicon()
{
	$("#like_icon").css('background','url(<?php echo SKIN_URL_IMAGE; ?>/side-icon-hover1.png)');
	$("#like_icon").css('background-repeat','no-repeat');
}

function change_bookmarkicon()
{
	if($("#bk_st").val() == '1')
	{
		$("#bookmark_icon").css('background','url(<?php echo SKIN_URL_IMAGE; ?>/side-icon-hover5.png)');
		$("#bk_st").val('0');
	}
	else
	{
		$("#bookmark_icon").css('background','url(<?php echo SKIN_URL_IMAGE; ?>/side-icon5.png)');
		$("#bk_st").val('1');
	}
	$("#bookmark_icon").css('background-repeat','no-repeat');
}

function change_notesicon()
{
	$("#notes").css('background','url(<?php echo SKIN_URL_IMAGE; ?>/side-icon-hover7.png)');
	$("#notes").css('background-repeat','no-repeat');
}

function change_ratingicon()
{
	$("#rating").css('background','url(<?php echo SKIN_URL_IMAGE; ?>/side-icon-hover4.png)');
	$("#rating").css('background-repeat','no-repeat');
}

function show_graph(target, period, div)
{
	//$("#side-member_analytics").show();
//	$("#"+div).toggle( "fast");
	$("#"+div).parents('div').show();
	if($("#"+div).html()=="")
	{
		$.ajax({
			url: '<?php echo base_url().BASE; ?>study/'+ target +'?period='+ period,
			async: false,
			type : 'POST',
			data : {'question_id' : '<?php echo $_GET['question_id']; ?>'},
			success: function(data){
					$("#"+div).show();
					$("#"+div+"_zoom").show();
					$("#"+div).html(data);
					$("#"+div+"_zoom").html(data);
			}
		});
	}
	else
	{
		$("#"+div+", #"+div+"_zoom").show();
	}
}

function show_member_analytics(id)
{
	$(".main-notes").hide();
	values = {'question_id' : '<?php echo $_GET['question_id']; ?>'};
	$.ajax({
		url: '<?php echo base_url().BASE; ?>study/'+id,
		type : 'POST',
		data : values,
		success: function (data){
			if(data == 'false')
			{
				$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
			}
			else if(data == 'Success')
			{
				//alert(data);				
			}
			else{
				$("#"+id+"_data, #"+id+"_data_zoom").html(data);
			}
			//allow = true;
		}
	});
}

function change_memberanalytics_icon(clicked_icon)
{
	$('.member-analytics1 li, .member-analytics2 li, .member-analytics3 li').removeAttr('class');
	$(clicked_icon).parent().attr('class','active');
	$("#tooltip_heading_member_analytics").html($(clicked_icon).parent().attr('title'));
}

function change_questionanalytics_icon(clicked_icon)
{
	$('.question-analytics1 li, .question-analytics2 li, .question-analytics3 li').removeAttr('class');
	$(clicked_icon).parent().attr('class','active');
}
/*
function change_memberanalytics_icon(clicked_icon)
{
	$('.member-analytics1 li, .member-analytics2 li, .member-analytics3 li').removeAttr('class');
	$(clicked_icon).parent().attr('class','active');
}
*/
function rate_this_que()
{
	setTimeout(function()
	{
		rating = $("#rating-score").val();
		values = {'question_id' : '<?php echo $_GET['question_id']; ?>','rating' : rating};
		$.ajax({
			url: '<?php echo base_url().BASE; ?>study/rate_this_question',
			type : 'POST',
			data : values,
			success: function (data){
				$(".side-notes").hide();
				if(data == 'false')
				{
					$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
				}
				else
				{
					//alert(data);				
				}
				//allow = true;
			}
		});
	}, 1000);
}

function set_flag(flag_type)
{
	values = {'question_id' : '<?php echo $_GET['question_id']; ?>', 'flag_type' : flag_type};
	$.ajax({
		url: '<?php echo base_url().BASE; ?>study/set_question_flags',
		type : 'POST',
		data : values,
		success: function (data){
			$(".main-notes").hide();
			$(".side-notes").hide();
			if(data == 'false')
			{
				$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
			}
			else if(data == 'Success')
			{
				//alert(data);				
			}
			//allow = true;
		}
	});
}


function show_tooltip_member_analytics(title)
{
	$("#tooltip_heading_member_analytics").html(title);
}

function hide_tooltip_member_analytics(title)
{
	$("#tooltip_heading_member_analytics").html(title);
}


function show_tooltip_question_analytics(title)
{
	$("#tooltip_heading_question_analytics").html(title);
}

function hide_tooltip_question_analytics(title)
{
	$("#tooltip_heading_question_analytics").html(title);
}


function show_tooltip_flexipad(title)
{
	$("#tooltip_heading_flexipad").html(title);
}

function hide_tooltip_flexipad(title)
{
	$("#tooltip_heading_flexipad").html(title);
}

function show_tooltip_que_types(title)
{
	$("#tooltip_heading_que_types").html(title);
}

function hide_tooltip_que_types(title)
{
	$("#tooltip_heading_que_types").html(title);
}

</script>			
<script type="text/javascript">
$(document).ready(function(){
	
	$("#member_question_upload_button").click(function(){
		if($("#ques").val() ==""){
			//alert('questions is empty');
		}
		else if($("#ans").val() ==""){
			//alert('answer is empty');
		}
		else
		{
			values = $("#member_question_upload_form").serialize() + "&question_id=<?php echo $_GET['question_id']; ?>";
			//alert(values);
			$.ajax({
				url: '<?php echo base_url().BASE; ?>study/upload_questions',
				type : 'POST',
				data : $("#member_question_upload_form").serialize(),
				success: function (html){
					if(html == 'false')
						$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
					else
						//alert(html);
						$(".side-notes").hide();
						$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
				}
			});
		}
	});
	
	

	$("#upload_question_tip_button").click(function(){
		if($("#question_tip").val() ==""){
			//alert('Question tip is empty');
		}
		else
		{	
			values = $("#upload_question_tip_form").serialize() + "&question_id=<?php echo $_GET['question_id']; ?>";
			//alert(values);
			$.ajax({
				url: '<?php echo base_url().BASE; ?>study/add_question_tip',
				type : 'POST',
				data : values,
				dataType: 'html',
				success: function (html){
					if(html == 'false')
						$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
					else
						//alert(html);
					//allow = true;
						$(".side-notes").hide();
						$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
				}
			});
			return false;
		}
	});
	

	$("#side-note-submit-button").click(function(){
		if($("#side-note").val() ==""){
			//alert('Note is empty');
		}
		else
		{
			values = $("#side-note").serialize() + "&type=note&question_id=<?php echo $_GET['question_id']; ?>";
			$.ajax({
				url: '<?php echo base_url().BASE; ?>study/set_question_note_or_bookmark',
				type : 'POST',
				data : values,
				dataType: 'html',
				success: function (html){
					if(html == 'false')
						$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
					else
						$("#side-note, #main-note").val(html);
						$(".side-notes").hide();
						$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
					//allow = true;
				}
			});
		}
	});
	
	$("#main-note-submit-button").click(function(){
		if($("#main-note").val() ==""){
			//alert('Note is empty');
		}
		else
		{	
			values = $("#main-note").serialize() + "&type=note&question_id=<?php echo $_GET['question_id']; ?>";
			$.ajax({
				url: '<?php echo base_url().BASE; ?>study/set_question_note_or_bookmark',
				type : 'POST',
				data : values,
				dataType: 'html',
				success: function (html){
					if(html == 'false')
						$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
					else
						$("#side-note, #main-note").val(html);
						$(".side-notes").hide();
						$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
					//allow = true;
				}
			});
		}
	});
	
	
	$("#add_event, #add_event2").click(function()
	{
		if($(this).attr('id') == 'add_event'){
			values = $("#addevent_form").serialize() + "&question_id=<?php echo $_GET['question_id']; ?>";
		}
		else{
			values = $("#addevent_form2").serialize() + "&question_id=<?php echo $_GET['question_id']; ?>";
		}
		$.ajax({
			url: '<?php echo base_url().BASE; ?>study/create_event',
			type : 'POST',
			data : values,
			dataType: 'html',
			success: function (html){
				if(html == 'false')
					$(location).attr('href','<?php echo base_url().BASE; ?>study/index');
				else
					//alert(html);
					$(".side-notes").hide();
					$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
				//allow = true;
			}
		});
		return false;
	});	
	
	
});  
</script>

<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="text/javascript">
function googleplusbtn(url) {
  share('goolgeplus');
  sharelink = "https://plus.google.com/share?url="+url;
  newwindow=window.open(sharelink,'name','height=400,width=600');
  if (window.focus) {newwindow.focus()}                                                                                                                                
  return false;
}   

function fbs_click(id) {
	var sh = $("#cur_url").val();
	share('facebook')
	var url = 'http://www.facebook.com/sharer.php?u=' +
    encodeURIComponent(sh);
	window.open(url, 'Share on FaceBook', 'left=20,top=20,width=550,height=400,toolbar=0,menubar=0,scrollbars=0,location=0,resizable=1');
	return false;
}

function popupCenter(url, title, w, h,webshare) {
  share(webshare);
  var left = (screen.width/2)-(w/2);
  var top = (screen.height/2)-(h/2);
  return window.open(url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}

function share(share){
//	var site=share;
//	alert('<?php echo $_GET['question_id']; ?>');
	$.ajax({
			type:"POST",
			url:'<?php echo base_url().BASE; ?>study/share_entry',		
			data:{'question_id':'<?php echo $_GET['question_id']; ?>', 'share':share},
			cache: false,
			success:function(html){
				//alert(html);
				$("#sharing_icons").hide();
				$(".quebar_icons").show();
				$(".side-notes").hide();
				$('form').find("input[type=text], input[type=date], input[type=time], textarea").val("");
			},
			 error:function(test){
				//alert('fail');
			 }
		});
}
</script>		
<style>
#starType img
{
	position:relative;
	top: 5px;
}
#starType img 
{
	width: 20px;
}
</style>
<link rel="stylesheet" href="<?php echo SKIN_URL_CSS; ?>/jquery.raty.css">
<script src="<?php echo SKIN_URL_JS; ?>/jquery.raty.js"></script>
<script>
  $.fn.raty.defaults.path = '<?php echo SKIN_URL_IMAGE; ?>';
  $(function() {
	$('#starType').raty({
	  half     : true,
	  targetScore: '#rating-score',
	  click : rate_this_que,
	  <?php 
		if($questions_rate != 'no result') 
		{ 
			echo "score : ".$questions_rate.",";
		} 
	   ?>
	  targetKeep : true
	});
  });
</script>